<%@ page pageEncoding="utf-8" %>
<%@include file="/commons/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<fmt:bundle basename="res">
<head>
    <meta charset="utf-8">
    <title><fmt:message key='zbtxshgl'/></title>
    <jsp:include page="/WEB-INF/commons/commons-header.jsp" flush="true"/>
</head>
<body>

<div class="layui-fluid">
    <div class="layui-card">
        <form name="totalForm" id="totalForm" class="layui-form layui-card-header layuiadmin-card-header-auto">
            <div class="layui-form-item">

                <div class="layui-inline">
                    <label class="layui-form-label" style="width: 80px;"><fmt:message key='skfs'/></label>
                    <div class="layui-input-inline">
                        <select name="payType">
                            <option value="0"><fmt:message key='qxz'/></option>
                            <option value="1" <c:if test="${params.payType == 1}">selected</c:if>><fmt:message key='wxlq'/></option>
                            <option value="2" <c:if test="${params.payType == 2}">selected</c:if>><fmt:message key='yhzz'/></option>
                        </select>
                    </div>
                </div>

                <div class="layui-inline">
                    <label class="layui-form-label" style="width: 80px;"><fmt:message key='zt'/></label>
                    <div class="layui-input-inline">
                        <select name="status">
                            <option value="0"><fmt:message key='qxz'/></option>
                            <option value="1" <c:if test="${params.status == 1}">selected</c:if>><fmt:message key='dzf'/></option>
                            <option value="2" <c:if test="${params.status == 2}">selected</c:if>><fmt:message key='zfz'/></option>
                            <option value="3" <c:if test="${params.status == 3}">selected</c:if>><fmt:message key='yjj'/></option>
                            <option value="4" <c:if test="${params.status == 4}">selected</c:if>><fmt:message key='zfcg'/></option>
                            <option value="5" <c:if test="${params.status == 5}">selected</c:if>><fmt:message key='zfsb'/></option>
                        </select>
                    </div>
                </div>


                <div class="layui-inline">
                    <button class="layui-btn layui-btn-sm layuiadmin-btn-list" id="search"><i class="layui-icon layui-icon-search layuiadmin-button-btn"></i> <fmt:message key='ss'/></button>
                </div>

            </div>
        </form>
    </div>
</div>

<div class="layui-card">
    <div class="layui-field-box layui-form">

        <table class="layui-table" lay-size="sm">
            <thead>
            <tr>
                <th><fmt:message key='xh'/></th>
                <th><fmt:message key='zbmc'/></th>
                <th><fmt:message key='sjh'/></th>
                <th><fmt:message key='txje'/></th>
                <th><fmt:message key='skfs'/></th>
                <th><fmt:message key='sqsj'/></th>
                <th><fmt:message key='skxx'/></th>
                <th><fmt:message key='zt'/></th>
                <th><fmt:message key='bz'/></th>
                <th><fmt:message key='cz'/></th>
            </tr>
            </thead>
            <c:forEach items="${page.result}" var="item" varStatus="status">
                <tr>
                    <td>${status.index + 1}</td>
                    <td>${item.user.liveName}</td>
                    <td>${item.user.mobile}</td>
                    <td>${item.money}</td>
                    <td>
                        <c:if test="${item.payType == 1}"><fmt:message key='wx'/></c:if>
                        <c:if test="${item.payType == 2}"><fmt:message key='yhk'/></c:if>
                    </td>
                    <td><fmt:formatDate value="${item.createTime}" type="both"/></td>
                    <td>
                        <c:if test="${item.payType == 1}"><fmt:message key='wx'/></c:if>
                        <c:if test="${item.payType == 2}">${item.bankName} ${item.bankCardNo}</c:if>
                    </td>
                    <td>
                        <c:if test="${item.status == 1}"><fmt:message key='dzf'/></c:if>
                        <c:if test="${item.status == 2}"><fmt:message key='zfz'/></c:if>
                        <c:if test="${item.status == 3}"><fmt:message key='yzf'/></c:if>
                        <c:if test="${item.status == 4}"><fmt:message key='zfcg'/></c:if>
                        <c:if test="${item.status == 5}"><fmt:message key='zfsb'/></c:if>
                    </td>
                    <td>${item.note}</td>
                    <td>
                        <div class="layui-btn-container">
                            <c:if test="${item.status == 1}">
                                <a href="javascript:void(0);" data-type="${item.payType}" data-id="${item.id}" class="layui-btn layui-btn-xs pay"><fmt:message key='zf'/></a>
                                <a href="javascript:void(0);" data-type="${item.payType}" data-id="${item.id}" class="layui-btn layui-btn-danger layui-btn-xs refuse"><fmt:message key='jj'/></a>
                            </c:if>
                        </div>
                    </td>
                </tr>
            </c:forEach>
        </table>
        <jsp:include page="/commons/page.jsp" flush="true"/>
    </div>
</div>

<script>

    layui.use("layer", function () {

        var layer = layui.layer;

        //通过
        $(".pay").click(function () {

            var id = $(this).attr("data-id");
            var type = $(this).attr("data-type");

            if (type === "1") {
                feijin.put({
                    url: "${web_domain}/mall/live/withdraw/checkWechatWithdraw",
                    data: {"status": 2, "ids": id}
                });
            } else {
                layer.open({
                    type: 2,
                    content: "${web_domain}/mall/live/withdraw/checkBankCardWithdraw?ids=" + id,
                    area: ["60%", "60%"],
                    btn: ["<fmt:message key='qd'/>", "<fmt:message key='qx'/>"],
                    yes: function (index, layero) {
                        layero.find('iframe').contents().find("#submit").click();
                    }
                });
            }
        });

        $(".refuse").click(function () {

            var id = $(this).attr("data-id");
            var type = $(this).attr("data-type");

            layer.prompt({
                "title": "<fmt:message key='bz'/>"
            }, function (value) {
                feijin.put({
                    url: "${web_domain}/mall/live/withdraw/" + (type === "1" ? "checkWechatWithdraw" : "checkBankCardWithdraw"),
                    data: {"status": 3, "ids": id, "note": value}
                });
            });
        });

    });
</script>
</body>
</fmt:bundle>
</html>
